
const yz = require('../comm/yz');
var moment = require("moment");
var iz = require('iz');
var math = require("mathjs");

exports.fmtMember = function (member) {
    // body...


    if (!member) {
        member = {};
    }

    member.name = yz.IsNullThen(member.name, "");

    member.pwd = yz.IsNullThen(member.pwd, "");
    member.tell = yz.IsNullThen(member.tell, "");
    member.email = yz.IsNullThen(member.email, "");
    member.address = yz.IsNullThen(member.address, {});
    member.array = yz.IsNullThen(member.array, []);
    member.roleArray = yz.IsNullThen(member.roleArray, []);

    member.picUrl = yz.IsNullThen(member.picUrl, "/public/images/dDefault.png");


    member.createTime = new Date(yz.IsNullThen(member.name, new Date()));
    member.address.memo = yz.IsNullThen(member.address.memo, "");
    member.memo = yz.IsNullThen(member.memo, "");

    return member

};

exports.fmtRole = function (role) {
    // body...
    role.name = yz.IsNullThen(role.name, "");

    role.memo = yz.IsNullThen(role.name, "");
    role.menuIdArray = yz.IsNullThen(role.menuIdArray, []);
    role.powerIdArray = yz.IsNullThen(role.powerIdArray, []);

    return role

};

exports.powerArray = function () {

    return [
        {
            id: "isAdmin",
            name: "系统管理员"

        },
        {
            id: "editCustomerOrder",
            name: "编辑订单"

        },
        {
            id: "editFlow",
            name: "修改流程"

        }



    ]
    // body...
};
